#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{

    double num;
    printf("请输入一个数（正数/负数）:");
    scanf("%lf",&num);
    //printf("num=%lf\n",num);
    //double fabs (double num);
    printf("绝对值为：%.f\n",fabs(num));  //保留整数部分

    char str[30]="20.30300This is test";
    char *ptr;
    double ret;

    ret = strtod(str, &ptr);
    printf("数字(double)是：%lf\n",ret);
    printf("字符串部分是：%s\n",ptr);

    char str2[30]="2030300 This is test";
    char *ptr2;
    long ret2;
    ret2 = strtol(str2, &ptr2,10);
    printf("数字(无符号长整数)是：%ld\n",ret2);
    printf("字符串部分是：|%s|\n",ptr2);


    return 0;
}
